package api

import (
	"github.com/gin-gonic/gin"
	jwt "github.com/golangblogs/gojwt"
	"zk3.12/api/handler"
)

func Router(r *gin.Engine) {
	api := r.Group("/api")
	{
		user := api.Group("/user")
		{
			user.POST("/up", handler.UserUpAndAdd)
		}
		live := api.Group("/live")
		{
			live.GET("/list", handler.LiveList) //直播间查看
			live.Use(jwt.JWTAuth("2210y"))
			live.POST("/add", handler.LiveAdd)       //直播间添加
			live.POST("/update", handler.LiveUpdate) //直播间修改
		}
		ws := api.Group("/ws")
		{
			ws.Use(jwt.JWTAuth("2210y"))
			ws.GET("/chat", handler.Chat)
		}
		liveroom := api.Group("/liveroom")
		{
			liveroom.POST("/add", handler.LiveRoomAdd)  //直播间添加
			liveroom.GET("/list", handler.LiveRoomList) //直播间查看

		}
	}
}
